<?php
/**
 * Created by PhpStorm.
 * User: gm
 * Date: 2018/12/11
 * Time: 14:19
 */
include "config.php";
include "status.php";
if($_SERVER["REQUEST_METHOD"]=="POST"){
    if(isset($_REQUEST["uname"])&&isset($_REQUEST["upwd"])){
        $UNAME=$_REQUEST["uname"];
        $UPWD=$_REQUEST["upwd"];
        $sql="SELECT u_id,u_email,u_name FROM userinfo WHERE (u_email=? OR u_name=?) AND u_pwd=?;";
        $stmt=$conn->prepare($sql);
        $stmt->bind_param("sss",$UNAME,$UNAME,$UPWD);
        $stmt->execute();
        $result=$stmt->get_result();
        //print_r($result);
        if($result->num_rows>=1){
            Status::$l_s["data"]=$result->fetch_assoc();
            print_r(json_encode(Status::$l_s));
        }else{
            print_r(json_encode(Status::$l_f));
        }

        $stmt->close();
        $conn->close();
    }else{
        print_r(json_encode(Status::$no_key));
    }
}else{
    print_r(json_encode(Status::$no_get));
}